package com.helloniu.wb.containers {

//// 白板的redo,undo

public class RedoUndoManager {
	public function RedoUndoManager() {
		steps = new Array(); 
	}
	
	/// 记下当前白板的状态
	public function addStep(currentInfo:*):void {		
		stepIdx = stepIdx + 1;

		steps.push(currentInfo);
		stepLength = steps.length;
	}

	public function redo():void {
		if(stepIdx >= stepLength - 1) {
			return;
		}

		stepIdx = stepIdx + 1;
		// do sth
	}

	public function undo():void {
		if(stepIdx <= 0) {
			return;
		}

		stepIdx = stepIdx - 1;
		// do sth
	}
	
	private var stepIdx:Number = 0; 
	private var currentIdx:Number = -1;
	private var stepLength:Number = 0;
	private var steps:Array = new Array();
}
}